-- The MathPad application may be installed wherever is convenient. It does not require or create any auxiliary files.
-- If you wish to use MathPad as a System 7 Apple Menu item, turn on the "Save and Quit" option via MathPad's Options... menu and save a document in the Apple Menu Items folder. For documents saved with this option on, clicking the window's close box will save the current text and quit the application. This is similar to the way desk accessory calculators operate. The option affects only the action of the close box. If you choose Close from the File menu, the document will be closed but the application will stay active.
-- If you want MathPad's close box to act like most applications, leave this option off.
-- MathPad may be used as a calculator simply by typing in numbers and operators. When the ENTER key is hit, each line will be evaluated and the results will be inserted into the text.
2*(3+4):14.000
-- MathPad inserts the ":" and the result "14". A status line at the bottom of the window will show a "├" to indicate that evaluation is complete. If any problems are encountered, they will be reported in the status line and the cursor will be moved to the problem in the text. More than one expression can be placed on a line if they are separated by semicolons.
-- Numbers may be entered in "e" format as in "12.3e-4". The following letter suffixes may also be used: G for e9, M for e6, k for e3, m for e-3, u or ╡ for e-6, n for e-9, p for e-12.
-- The constant ╣ can be entered via the menu or by typing option-p.
-- Numeric output format can be controlled via the menu.
-- MathPad allows the user to type in equations using variables that will be given numeric values elsewhere in the text.
force=mass*accel
force:160.000
mass=5
accel=32
-- MathPad evaluates the entire text so numeric values can be given before or after they are used. A variable has the same numeric value everywhere in the document.
--When asked for the value of a variable whose numeric value is unknown, MathPad will give an expression involving the variables that have not been given numeric values. In some complex cases MathPad will simply give "?" when a numeric value cannot be calculated.
A=B+C
D=A*4
D:(B+C)*4.000
-- MathPad does not perform algebra. The equation A=B+C (or B+C=A) tells how to compute A given B and C but MathPad does not derive any information about how to compute values for B or C from A.
-- When both sides of an equation evaluate to a constant, the values are checked and any inequality is reported.
-- Multiple definitions of a variable are allowed. If any of the definitions evaluate to a constant then that value will be used. When more than one definition evaluates to a constant, an inequality will be reported if they do not all have the same value.
-- Note that all variable definitions are also assertions.
-- Assertions are checked to the precision of the current numeric output format.
-- MathPad has most of the usual built-in functions: abs() acos() asin() atan() cos() exp() ln() log() sin() sqrt() tan() trunc(). Built-in functions may either be typed in or selected from the menu.
-- The argument units for trig functions can be changed to either degrees or radians with the menu.
-- The built-in function sum(expr,var,lower,upper) performs a summation of "expr" while incrementing "var" between "lower" and "upper". The expression given as the first parameter is re-evaluated for each step. Expressions for "lower" and "upper" are evaluated only once.
-- Users can also define their own functions. Functions differ from equations in that their parameter names refer to temporary variables that can take on different values each time the function is called.
Force(mass,accel)=mass*accel
Force(10,12):120.000
mass=5; accel=32
Force(6,8):48.000
mass*accel:160.000
-- In this example the parameters "accel" and "mass" are entirely separate from the global variables "accel" and "mass". Any variables used in the definition that do not appear in the parameter list will refer to global variables. Functions can be referenced before they are defined.
-- All references to a function must have the same number of parameters.
-- Multiple definitions of function names are not allowed.
-- The value of an expression can be made dependent on a condition.
y = -x when x < 0,
1 when x = 0,
x^2 otherwise
-- The result will be the value corresponding to first condition in the list that evaluates true. Commas separate expressions in the list. The comma separated expressions may be on the same or separate lines but if RETURNs are used they must follow the commas.
-- The keyword "otherwise" is optional and is used only to help readability.
-- The conditional follows the keyword "when" and may use the following operators: = != > < >= <= "and" "or" "not" "known" "unknown". The option key versions of comparison operators are also accepted (¡, │, ▓). Note that in this context "=" is a comparison operator. The C style operator "==" is also accepted.
-- The prefix operators "known" and "unknown" can be used to test if a numeric value can be calculated for the given expression.
-- Parenthesis are used only for arithmetic expressions and can not be used to group conditional operators. Arbitrarily complex conditionals can still be built by using multiple clauses and nested conditionals.
-- Comma separated expressions can also be used without conditionals. In this case the result will be the first item in the list that evaluates to a numeric value.
-- MathPad allows recursive function definitions. Depth of recursion is limited by available memory space. If memory runs low during evaluation, recursion is stopped.
-- Evaluation can also be stopped by typing Command-period.
-- MathPad can produce simple plots by using the "plot" command.
Xmin=0; Xmax=10
Ymin=0; Ymax=Xmax^2
plot X^2
-- Plotting is controlled by special variables. The independent variable "X" is stepped between "Xmin" and "Xmax" with a resolution of "Xsteps" (default Xsteps=100). The expression values are plotted between "Ymin" and "Ymax". The variable name 'X' (upper case) should not be used for anything other that the plot. Control variables have default values but if expressions are given they must evaluate to a constant.
-- Evaluation can be stopped by typing Command-period.
-- A status line at the bottom of the plot window shows the lowest and highest Y values ("lo" and "hi") calculated during the plot. This is useful in picking appropriate settings for Ymin and Ymax.
-- Clicking the mouse on the plot will show the calculated expression value for the X location of the click.
-- Multiple traces can be plotted simply by adding plot statements. All traces use the same values of "Xmin", "Xmax" , "Xsteps", "Ymin" and "Ymax". The click location applies only to the first trace. The "lo" and "hi" values apply over all traces.
-- The plot window is normally left behind the text window since all editing takes place in the text window. Size the text window and plot window so that they are both visible.
-- A plot can be copied to the clipboard as a PICT. The "Copy Plot" menu items are enabled when the plot window is in front. The clipboard image will be the same size as the current plot window size. The "Copy Plot at 4X" command scales the image up to provide a higher resolution image for applications that can import and re-size PICTs.
-- A plot can be printed. For printing the plot is re-sized to the page regardless of the current plot window size. Printing is done at the highest printer resolution so it may be useful to increase Xsteps for a smoother plot.
-- Arbitrary text labels may be pasted into the plot window. Selecting "Paste Label" from the Edit menu will paste text from clipboard into the upper left corner of the plot.
--Labels can be moved by dragging with the mouse.
--Labels can be deleted by dragging them off the plot.
-- MathPad can produce tables of numeric results using the "table" command.
Nmin=0; Nmax=10; Nsteps=11;
table N^3
0.000 0.000
1.000 1.000
2.000 8.000
3.000 27.000
4.000 64.000
5.000 125.000
6.000 216.000
7.000 343.000
8.000 512.000
9.000 729.000
10.000 1000.000
-- Tables are handled in the same way as plots except that the results are inserted as two columns into the text window. For tables the independent variable is "N" and the control variables are "Nmin", "Nmax" and "Nsteps".
-- Nsteps is limited to 1000 to prevent accidents from inserting huge amounts of text.
-- Do not add any text to the output columns because the table command will not be able to properly delete the table before re-evaluating.
-- MathPad ignores text enclosed in brackets [] or text between "--" and the next RETURN. Bracket comments terminate at close bracket or RETURN. This README file is made up mostly of comments and can be evaluated by MathPad.
-- A line beginning with --ª will cause a page break on printout (ª is option 7).
-- MathPad documents are generic TEXT files. Option and plot label information is stored in the resource fork. TEXT files created by other applications may be opened by MathPad and vice versa. The resource fork is not modified until the file is saved. Documents are limited to a maximum size of 32K bytes. Only one document can be open at a time.
-- Memory size
-- MathPad's size is set fairly small (150K) because it is intended as a desk accessory style application. If you use only small files and no printing, plotting or tables, the size could be reduced to 115K. However, even 150K may not be enough for evaluating very large complex files.
-- Recursive functions can require large amounts of memory but increasing the application memory size past a certain point will not allow deeper recursion. This is because evaluation of recursive functions also uses up stack space which has a fixed allocation size.